package com.ynjt.server;

import com.ynjt.util.Decoder;
import com.ynjt.util.Encoder;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

public class ChatServerInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
        ChannelPipeline pipeline = socketChannel.pipeline();

        pipeline.addLast(new Decoder());
        pipeline.addLast(new Encoder());
        pipeline.addLast(new ChatServerHandler());

        System.out.println("用户:"+socketChannel.remoteAddress() +" 连接成功");
    }
}
